<div bsModal #createOrEditModal="bs-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="createOrEditModal"
  aria-hidden="true" [config]="{backdrop: 'static'}">
  <div class="modal-dialog modal-lg">
    <div class="modal-content">
      <form *ngIf="active" #editForm="ngForm" novalidate (ngSubmit)="save()" autocomplete="off">
        <div class="modal-header">
          <h4 class="modal-title">
            <span *ngIf="classification.id">编辑分类: {{classification.displayName}}</span>
            <span *ngIf="!classification.id">创建新的分类: {{classification.parentId === null? '基类' : '父级(' +
              parentClassification.displayName + ')'}}</span>
          </h4>
          <button type="button" class="close" (click)="close()" [attr.aria-label]="l('Close')">
            <span aria-hidden="true">&times;</span>
          </button>
        </div>
        <div class="modal-body">

          <div class="form-group">
            <label for="equipName">资源类型 *</label>
            <div class="row" style="margin: 0;">
                <div class="col-md-6" style="padding-left:0;">
                    <select #toolTypeCombobox name="toolType" class="form-control" [(ngModel)]="classification.type"
                      [attr.data-live-search]="true" jq-plugin="selectpicker" required minlength="1">
                      <option value="">{{emptyText}}</option>
                      <option *ngFor="let toolType of toolTypes" [value]="toolType.value">{{toolType.displayText}}</option>
                    </select>
                  </div>
                  <div class="col-md-6" style="padding-right:0;">
                    <div class="md-checkbox-list">
                      <div class="m-checkbox-inline">
                        <label class="m-checkbox m-checkbox--bold m-checkbox--state-success">
                          <input type="checkbox" name="HaveChildren" [(ngModel)]="classification.haveChildren">是否可以创建子类
                          <span></span>
                        </label>
                      </div>
                    </div>
                  </div>
            </div>
          </div>

          <div class="form-group">
            <label for="displayName">名称 *</label>
            <input id="displayName" #displayNameInput="ngModel" type="text" name="displayName" class="form-control"
              [(ngModel)]="classification.displayName" required>
            <validation-messages [formCtrl]="displayNameInput"></validation-messages>
          </div>

          <div class="form-group">
            <label for="code">编号 *</label>
            <input id="code" #codeInput="ngModel" type="text" name="code" class="form-control" [(ngModel)]="classification.code"
              required>
            <validation-messages [formCtrl]="codeInput"></validation-messages>
          </div>

          <div class="form-group">
            <label for="unit">单位</label>
            <input id="unit" type="text" name="unit" class="form-control" [(ngModel)]="classification.unit">
          </div>
        </div>
        <div class="modal-footer">
          <button [disabled]="saving" type="button" class="btn btn-default" (click)="close()">{{l("Cancel")}}</button>
          <button type="submit" class="btn btn-primary" [disabled]="!editForm.form.valid" [buttonBusy]="saving"
            [busyText]="l('SavingWithThreeDot')"><i class="fa fa-save"></i> <span>{{l("Save")}}</span></button>
        </div>
      </form>
    </div>
  </div>
</div>
